package com.java2_4;

import java.util.Random;
import java.util.Scanner;

public class javatext2_4 {
    //    //方法参数传递
////    public static void main(String[] args) {
////        int a = 100;
////        change(a);
////        System.out.println(a);  //100传值调用
////    }
////
////    public static void change(int number) {
////        number += 100;
////        return;
////    }
////    public static void main(String[] args) {
////        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
////        change(arr);
////        for (int i = 0; i < arr.length; i++) {
////            System.out.print(arr[i] + " "); //100 100 100 100 100 100 100 100 100 100 传指调用
////        }
////    }
////    public static void change(int[] arr){
////        for (int i = 0; i < arr.length; i++) {
////            arr[i] = 100;
////        }
////        return;
////    }
//    //方法重载 + return
//    //方法重载：在一个class方法名字相同但是其参数不同，而导致的重载
////    public static void main(String[] args) {
////        text();
////        text(2);
////        text(4,"watermelon");
////    }
////    //方法重载
////    public static void text() {
////        System.out.println("我吃了1个西瓜！");
////    }
////
////    public static void text(int number) {
////        System.out.println("我吃了" + number + "个西瓜！");
////    }
////
////    public static void text(int number, String fruit) {
////        System.out.println("我吃了" + number + "个" + fruit + "！");
////    }
//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in); //构造器
//        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
//        System.out.print("请输入您套查找的数据： ");
//        int input_number = sc.nextInt();
//        int ret = search_array(input_number, arr);
//
//        System.out.println(ret);
//    }
//
//    public static int search_array(int number, int[] arr) {
//        for (int i = 0; i < arr.length; i++) {
//            if (arr[i] == number) {
//                return arr[i];  //return语句  类似于break
//            }
//        }
//        return -1;
//    }
//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        System.out.println("please input the age: ");
//        int age = sc.nextInt();
//        System.out.println(age > 18 ? "您已经成年了" : "您还没有成年！");
//    }
    // xxx ? : == if else
//    public static void main(String[] args) {
//        //类、对象的定义：
//        Student s = new Student();
//        //System.out.println(s);
//        s.name = "zhangsan";
//        s.age = 20;
//        s.sex = '男';
//        System.out.println(s.name);
//        System.out.println(s.age);
//        System.out.println(s.sex);
//    }
    //类、对象
//    public static void main(String[] args) {
//        Car_information c = new Car_information(); //构造器
//         c.money = 34.57;
//         c.name = "宝马X";
//         c.index = 1;
//         c.information();
//        System.out.println(c.money);
//        System.out.println(c.name);
//        System.out.println(c.index);
//    }
//    public static void main(String[] args) {
//        //类、对象的注意事项：
//        classroom_score cs = new classroom_score();
//        cs.number = 5;
//        cs.sex = '男';
//        Scanner s = new Scanner(System.in);
//        for (int i = 0; i < cs.name.length; i++) {
//            String input = s.next();
//            cs.name[i] = input;
//        }
//        System.out.println(cs.number);
//        System.out.println(cs.sex);
//        for (int i = 0; i < cs.name.length; i++) {
//            System.out.println(cs.name[i]);
//        }
//        //一个class中只能有一个public 其他都没有，而且public的必须成为文件名
//    }
//    public static void main(String[] args) {
//
//    }
//    public static void main(String[] args) {
//        //构造的的作用
////        （1）传递地址
////        （2）初始化
//        //this 类、对象的地址
////        make_mechine M = new make_mechine();
////        System.out.println(M);
//        //make_mechine M = new make_mechine("zhangsan", 10);
//        make_mechine M = new make_mechine();
//        System.out.println(M.name);
//        System.out.println(M.index);
//        M.age = 18;
//        M.sex = '男';
//        System.out.println(M.age);
//        System.out.println(M.sex);
//    }
//    里面存储的东西的默认值和数组相同
//    public static void main(String[] args) {
//        make_mechine M = new make_mechine(); //构造器
//        make_mechine N = new make_mechine(); //构造器
//        N = M;
//        System.out.println(N);
//        System.out.println(M);
//        N.name = "coco";
//        M.name = "zhangsan";
//        System.out.println(N.name);
//    }
//    public static void main(String[] args) {
//        //封装 and JavaBean
//        classmember mem = new classmember();
//        //mem.text();
//        mem.setName("zhangsan");
//        String name = mem.getName();
//        System.out.println(name);
//        mem.setAge(18);
//        System.out.println(mem.getAge());
//        mem.setIndex(100);
//        System.out.println(mem.getIndex());
//        mem.setSex('男');
//        System.out.println(mem.getSex());
//        System.out.println("-----------------------");
//        classmember member = new classmember("lisi",20,9,'女');
//        System.out.println(member.getName());
//        System.out.println(member.getAge());
//        System.out.println(member.getIndex());
//        System.out.println(member.getSex());
//        mem.text();
//    }
//    public static void main(String[] args) {
//        carInformation i = new carInformation();
//        i.setName("宝马X");
//        i.setMoney(34.98);
//        i.setIndex(100);
//        System.out.println(i.getName());
//        System.out.println(i.getMoney());
//        System.out.println(i.getIndex());
//        System.out.println("--------------------------");
//        carInformation In = new carInformation("奔驰",28.59,30);
//        System.out.println(In.getName());
//        System.out.println(In.getMoney());
//        System.out.println(In.getIndex());
//
//    }
//    public static void main(String[] args) {
//        //数组元素求和
//        int[] arr = new int[5];
//        Scanner sc = new Scanner(System.in);
//        for (int i = 0; i < arr.length; i++) {
//            System.out.print("please input the " + i + " number: ");
//            int inputNnumber = sc.nextInt();
//            arr[i] = inputNnumber;
//        }
//        int sum = 0;
//        for (int i = 0; i < arr.length; i++) {
//            sum += arr[i];
//        }
//        System.out.println(sum);
//    }
//    public static void main(String[] args) {
//        double[] arr = new double[7];
//        Scanner sc = new Scanner(System.in); //构造器
//        for (int i = 0; i < arr.length; i++) {
//            System.out.print("please input the " + i + " number: ");
//            double inputNumber = sc.nextDouble();
//            arr[i] = inputNumber;
//        }
//        double ret = Sum(arr);
//        System.out.println(ret);
//    }
//
//    public static double Sum(double[] arr) {
//        double sumNumber = 0.0;
//        for (int i = 0; i < arr.length; i++) {
//            sumNumber += arr[i];
//        }
//        return sumNumber;
//    }
//    public static void main(String[] args) {
//        double[] arr = new double[6];
//        Scanner sc = new Scanner(System.in);
//        for (int i = 0; i < arr.length; i++) {
//            System.out.print("please input the " + i + " number: ");
//            double inputNumber = sc.nextDouble();
//            arr[i] = inputNumber;
//        }
//        double ret = arrayMan(arr);
//        System.out.println(ret);
//    }
//
//    public static double arrayMan(double[] arr) {
//        double max = arr[0];
//        for (int i = 0; i < arr.length; i++) {
//            if (max < arr[i]) {
//                max = arr[i];
//            }
//        }
//        return max;
//    }
    //猜数字游戏:
//    Random luckNumber = new Random(); //构造器
//    Scanner sc = new Scanner(System.in);
//    int number = luckNumber.nextInt(10) + 1;
//    while(true){
//        System.out.print("please input your number: ");
//        int myNumber = sc.nextInt();
////        if(myNumber == number){
////            break;
////        }
//        break;
//    }
//    public static void main(String[] args) {
//
//
//    //猜数字游戏:
////    Random luckNumber = new Random(); //构造器
////    Scanner sc = new Scanner(System.in);
////    int number = luckNumber.nextInt(10) + 1;
////    while(true){
////        System.out.print("please input your number: ");
////        int myNumber = sc.nextInt();
//////        if(myNumber == number){
//////            break;
//////        }
////        break;
////    }
////        for (int i = 0; i < 10; i++) {
////            if(i == 3){
////                break;
////            }
////        }
////        int i = 0;
////        while (i < 10) {
////            if(i == 5){
////                break;
////            }
////            i++;
////        }
////    }
//
//}
//    public static void main(String[] args) {
//        //猜数字游戏:
//        Random luckNumber = new Random(); //构造器
//        Scanner sc = new Scanner(System.in);
//        //生成随机数
//        int number = luckNumber.nextInt(10) + 1;
//
//        while (true) {
//            System.out.print("please input your number: ");
//            int myNumber = sc.nextInt();
//            if (myNumber == number) {
//                System.out.println("恭喜你才对了 luckNumber 是"+ number);
//                break;
//            }
//        }
//    }
    public static void main(String[] args) {
        //冒泡排序
        int[] arr = {3, 4, 2, 1, 5, 7, 8, 6, 9, 10};
        for (int i = 0; i < arr.length - 1; i++) {
            boolean flag = true;
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if(arr[j] > arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j + 1] = temp;
                    flag = false;
                }
            }
            if(flag){
                break;
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}